#Title: The return Statement : JavaScript Functions

Functions that will return a result must use the "return" statement. This statement specifies the value which will be returned to where the function was called from.

Say you have a function that returns the sum of two numbers:

function total(a,b)
{
result=a+b
return result
}

When you call this function you must send two arguments with it:

sum=total(2,3)

The returned value from the function (5) will be stored in the variable called sum.

#Title: JavaScript Functions
#Element: 170: JavaScript Functions